//
// Created by chaseaishang on 23-5-10.
//

#pragma once
#include "Render/StdAfx.h"
#include "Render/Renderer.h"
#include "Render/Shader.h"
#include "Render/Texture.h"
#include <memory>
class SpriteRenderer
{
public:
    SpriteRenderer(std::string file_vs,std::string file_fs);

    ~SpriteRenderer();
    void Set_viewProjection(glm::mat4&view_proj);
    void DrawSprite(const Texture &texture, glm::vec2 position,
                    glm::vec2 size = glm::vec2(10, 10), GLfloat rotate = 0.0f,
                    glm::vec3 color = glm::vec3(1.0f));
private:
    std::unique_ptr<VertexArray> m_quadVAO;
    std::unique_ptr<IndexBuffer> m_IndexBuffer;
    std::unique_ptr<VertexBuffer> m_VertexBuffer;
    std::unique_ptr<Shader> m_Shader;
    std::unique_ptr<Renderer> m_Renderer;
    glm::mat4 m_view_proj;

    void initRenderData(std::string file_vs, std::string file_fs);
};


